<template>
  <div>
    <router-view />
    <tabbar v-show="isTab"></tabbar>
  </div>
</template>

<script>
import Tabbar from './common/Tabbar';

export default {
  name: 'main',
  components: {
    Tabbar,
  },
  created() {
    // this.$router.push('/');
  },
  computed: {
    isTab() {
      return this.$store.state.tabHidden;
    },
  },
  watch: {
    // 监听路由跳转
    $route() {
      // 如果从state中取出tabHidden 是false则将tabHidden设置成false
      if (!this.$store.state.tabHidden) {
        this.$store.dispatch('tabHidden');
      }
    },
  },
};
</script>

<style scoped>
</style>
